<template>
  	<div id="name">
    	<div class="wl-body">
      		<div class="top"></div>
      		<div class="bdds">
        		<div class="zc-top topbox slideOut">
          			<div>
						<div class="txtsde txtc t-left m-1 slideOut">
							<!-- {{ $t("m.zzhzczh") }}(USDT) -->
							{{ $t("m.zzhzczh") }}(USDT)
						</div>
            			<div class="wl-ptsh-txt slideOut">
							<countTo
								v-if="see"
								:startVal="0"
								:decimals="4"
								:endVal="Number(walletData.trxAmount)"
								:duration="2000"
							></countTo>
              				<span v-else>*****</span>
            			</div>
						
          			</div>
					<div
						@click="tosee"
						class="tr-see"
						:class="see ? 'see' : 'nosee'"
					></div>
        		</div>
				<div>
					<div class="mtp slink topchanger">
						<div class="xks" @click="tabNav(1)" :class="{'active':tab_nav==1}">{{ $t("m.yezh") }}</div>
						<div class="xks" @click="tabNav(2)" :class="{'active':tab_nav==2}">{{ $t("m.syzh") }}</div>
					</div>
				</div>
				
        		<div class="content">
					<div class="m-2 bottmls slideIn">
						<div class="txtsde txtc t-left m-1">
							<!-- 挖矿收益资产折合（USDT） -->
							{{ $t("m.wksyzczh") }}(USDT)
							<!-- {{ $t("m.yezhzzczh") }}(USDT) -->
						</div>
						<div class="wl-ptsh-txt">
							{{ see ? (s ? walletData.trxAmount.toFixed(4) : "0") : "*****" }}
						</div>
					
        			</div>
					<!-- 余额账户 -->
        			<div id="content" :class="{'cactive':tab_nav==1}">
          				<div class="link-item bottmls" @click="goto('zcusdt')">
            				<div class="zc-dj t-left">USDT</div>
							<div class="slink defcf">
								<div class="flex1">{{ $t("m.ky") }}</div>
								<div class="flex1">{{ $t("m.zh") }}({{ bzdw }})</div>
							</div>
            				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? walletData.trxAmount.toFixed(4) : "0") : "*****" }}
								</div>

								<div class="flex1">
									{{
									see ? (s ? (walletData.trxAmount * utoc).toFixed(2) : "0") : "*****"
									}}
								</div>
            				</div>
            				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
          				</div>
          			
        			</div>
					<!-- 收益账户 -->
					<div id="content" :class="{'cactive':tab_nav==2}">
          				<div class="link-item bottmls">
            				<div class="zc-dj t-left">
								<!-- 我的推荐 -->
								{{$t("m.wdtj")}}
							</div>
							<div class="slink defcf">
								<!-- 直推人数 -->
								<!-- <div class="flex1">
									
									{{ $t("m.ztrs") }}
								</div> -->
								<div class="flex1">
									<!-- 团队人数 -->
									{{ $t("m.tdrs") }}
								</div>
							</div>
            				<div class="slink u-dj">
								<!-- <div class="flex1">
									{{ see ? (s ? walletData.trxAmount.toFixed(4) : "0") : "*****" }}
								</div> -->

								<div class="flex1">
									{{
									see ? (s ? walletData.teamNum : "0") : "*****"
									}}
								</div>
            				</div>
            				
          				</div>
						<div class="link-item bottmls" @click="goto('jdfh')">
            				<div class="zc-dj t-left">
								{{$t("m.sqsy")}}
							</div>
							<div class="slink defcf">
								<div class="flex1">
									USDT
								</div>
								<div class="flex1">
									{{ $t("m.zh") }}(CNY)
								</div>
							</div>
            				<div class="slink u-dj">
								<div class="flex1">
									{{ walletData.communityPrice}}
								</div>

								<div class="flex1">
									{{
									see ? (s ? (walletData.communityPrice * utoc).toFixed(2) : "0") : "*****"
									}}
								</div>
            				</div>
            				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
          				</div>
						<!-- <div class="link-item bottmls" @click="goto('zcusdt')">
            				<div class="zc-dj t-left">
								
								{{$t("m.ztsy")}}
							</div>
							<div class="slink defcf">
								<div class="flex1">
									USDT
								</div>
								<div class="flex1">
									{{ $t("m.zh") }}(CNY)
								</div>
							</div>
            				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? walletData.trxAmount.toFixed(4) : "0") : "*****" }}
								</div>

								<div class="flex1">
									{{
									see ? (s ? (walletData.trxAmount * utoc).toFixed(2) : "0") : "*****"
									}}
								</div>
            				</div>
            				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
          				</div> -->
						<div class="link-item bottmls" @click="goto('ztsy')">
            				<div class="zc-dj t-left">
								{{$t("m.syfh")}}
							</div>
							<div class="slink defcf">
								<div class="flex1">
									{{ $t("m.sqdj") }}
								</div>
								<div class="flex1">
									{{ $t("m.zh") }}(CNY)
								</div>
							</div>
            				<div class="slink u-dj">
								<div class="flex1">
									{{walletData.contractLevel==0?$t("m.tyyh"):walletData.contractLevel>0?walletData.contractLevel+'V'+$t("m.shequ"):$t("m.wxyh")}}
								</div>

								<div class="flex1">
									{{
									see ? (s ? (walletData.trxAmount * utoc).toFixed(2) : "0") : "*****"
									}}
								</div>
            				</div>
            				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
          				</div>
        			</div>
				</div>
      		</div>
    	</div>
  	</div>
</template>

<script>
import countTo from "vue-count-to";
export default {
  	name: "name",
  	data() {
		return {
			tab_nav:1,//当前选项
			walletData:{},//钱包信息
		};
  	},
  	computed: {
		see() {
			if (this.$store.getters.see == "1") {
				return true;
			} else {
				return false;
			}
		},
		utoc() {
			return this.$store.getters.utoc;
		},

		bzdw() {
			if (this.$store.getters.language == "zh-CN") {
				return "CNY";
			} else {
				return "USD";
			}
		},
  	},
	created() {
		console.log('钱包信息-----',this.$store.getters.s)
		this.walletData = this.$store.getters.s
		this.s = JSON.parse(sessionStorage.getItem("s"));
		setTimeout(() => {
			this.getdata();
		}, 1000);
	},
  	components: { countTo },
  	mounted() {
    	if (window.history && window.history.pushState) {
      		history.pushState(null, null, document.URL);
      		window.addEventListener("popstate", this.goBack, false);
    	}
  	},
	destroyed() {
		window.removeEventListener("popstate", this.goBack, false);
	},
  	methods: {
		//切换tab
		tabNav(e){
			this.tab_nav = e
		},
		guanbi() {
			this.$router.push({ path: "/" });
		},
		changers(val) {
			this.acchange = val;
		},
		changersw(val) {
			this.acchangew = val;
		},
    	tosee() {
			this.sees = !this.sees;
			if (this.sees) {
				this.$store.commit("see", 1);
			} else {
				this.$store.commit("see", 0);
			}
    	},
		goto(val) {
			this.$router.push({ path: val });
		},
		getdata() {
			let datas = {
				params: {
					address: this.$store.getters.userWallet,
				},
			};
			this.$get({
				url: "wms-wallet/getWallet",
				data: datas,
				callback: (data) => {
				this.$nextTick(function () {
					this.s = data.data;
					if (this.s) {
					this.$store.commit("nameid", this.s.id);
					this.$store.commit("s", this.s);
					}
				});
				},
			}).catch(() => {
				this.$toast(this.$i18n.t("m.errordata"));
			});
		},
		goBack() {
			this.$router.replace({ path: "/" });
			// sessionStorage.clear();
			// window.history.back();
			// history.pushState(null, null, document.URL);
		},
  	},
};
</script>

<style scoped>
	#content{
		display: none;
	}
	#content.cactive{
		display: block;
	}
</style>